<?php

namespace app\admin\model;

use think\db\Query;
use think\Model;

class Menu extends Model
{
    protected $autoWriteTimestamp = 'datetime';
    // 定义时间戳字段名
    protected $createTime = 'created_at';
    protected $updateTime = 'updated_at';

    public function searchUaAttr(Query $query, $value)
    {
        $query->where('ua', $value);
    }

    public function permission()
    {
        return $this->belongsTo(Permission::class, 'permission_id');
    }
}
